<?php
namespace app\common\exception;
use app\common\enum\ErrorCodeEnum;
use app\common\enum\HttpCodeEnum;

/**
 * token验证失败时抛出此异常 
 */
class TokenException extends BaseException {

    public function __construct(array $params = [])
    {
        $this->code = isset($params['code']) && $params['code'] ? $params['code'] : HttpCodeEnum::CODE_200;
        $this->msg = isset($params['msg']) && $params['msg'] ? $params['msg'] : 'Token已过期或无效Token';
        $this->error_code = isset($params['error_code']) && $params['error_code'] ? $params['error_code'] : ErrorCodeEnum::TOKEN;
        //$this->content = isset($params['content']) && $params['content'] ? $params['content'] : '';
        parent::__construct($params);
    }
}
